package com.it.you.base.bigdecimal;

import com.it.you.pojo.Computer;
import com.it.you.pojo.ItemBasic;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class BIgdecimalTest3 {

    public static void main(String[] args) {
        ItemBasic itemBasic = new ItemBasic();
        itemBasic.setMemberPrice(new BigDecimal(20));
        Computer computer = new Computer();
        computer.setIsChargePrice(1);
        computer.setBuyPrice(new BigDecimal(16));
        computer.setItemBasic(itemBasic);
        List<Computer> list = new ArrayList<>();
        list.add(computer);
        Integer num = 1;
        //按照条件查询是否存在
        boolean result = list.stream().anyMatch(co -> num.equals(co.getIsChargePrice()) && co.getBuyPrice() != null && co.getBuyPrice().compareTo(co.getItemBasic().getMemberPrice()) < 0);
        System.out.println(result);
    }
}
